from google.appengine.ext import db
from horseanalysis.lib.callable import Callable
from horseanalysis.model.twin_odd import TwinOdd

class Quinella(TwinOdd):
  def get_odds(batch_time):
    return Quinella.gql('WHERE batch_time = :1', batch_time)
  
  def get_hashed_odds(batch_time):
    result = {}
    odds = Quinella.get_odds(batch_time)
    for item in odds:
      result[str(item.first_horse_no) + '-' + str(item.second_horse_no)] = item.odds
    return result
    
  get_odds = Callable(get_odds)
  get_hashed_odds = Callable(get_hashed_odds)